<?php
	//AVISO DEL AUTOR: De verdad, de verdad que lo siento mucho, no queria hacer esta chapuza, pero no tenia tiempo para más.
	//Aceptaré de buen grado cualquier crítica o amenaza de muerte.
	$javascript->link(array('lightbox.js','bookflip.js','meinteresa.js','contact-form2.js'),false);
	$html->css('lightbox','stylesheet',array('inline' => false));
	$existe=false;
	$estamosPromocion=($this->params['pass'][0] == 'promociones');
	if ($estamosPromocion) {
		echo '<div style="padding:90px 0 0 0;color:red;"><p>!Pasa página!</p><div id="myBook" style="display:none;">';
	}else {
		echo '<ul id="items">';
	}
	foreach($products as $product) {
		$existe=true;
		$thumbnailUrl = isset($product['Image']['url_thumbnail'])?$product['Image']['url_thumbnail']:"no-image.jpg";
		$fullUrl = isset($product['Image']['url_full'])?$product['Image']['url_full']:"no-image.jpg";
		if ($estamosPromocion) {?>
		
			<div style="background:#f3f1e9 url('<?php echo $this->webroot."img/upload/".$fullUrl; ?>');color:#ffffff;background-repeat:no-repeat; ">
			</div>
					
			
	<?php }else { ?>
		<li class="item">
			<div id="light" class="galleryImage">
				<a href="<?php echo $this->webroot."img/upload/".$fullUrl; ?>" rel="lightbox[salones]" >
				<img src="<?php echo $this->webroot."img/upload/".$thumbnailUrl; ?>" alt="<?php echo $product['name']; ?>"></img>
				</a>
			</div>
			<a href="#" id="show-panel" rel="<?php echo $product['name']; ?>" class="buy">Me interesa &oplus;</a>
		</li>
	<?php }
	 } 
		if(!$existe){ echo "Galería vacía. ¡Pronto añadiremos contenido!";} 
	
	if ($estamosPromocion) {
		echo '</div></div>';
	}else {
		echo '</ul>';
	}?>


    <div class="lightbox-panel" id="lightbox-panel">  
    <p align="right">  
    	<a id="close-panel" class="close-panel" href="#">X</a>  
    </p>
    <h2>Formulario de envio</h2>  
    <p>A usted le interesa este producto.</p> 
       
    <form id="form_contacto" class='contacto' action="">
		<div class='seccion_form_contacto'>
			<input class='degradado' type="text" name="nombre" value="Nombre" />
		</div>
		<div class='seccion_form_contacto'>
			<input class='degradado' type="text" name="direccion" value="E-Mail" />
		</div>
		<div class='seccion_form_contacto'>
			<textarea class='degradado' name="cuerpo_mensaje">Mensaje</textarea>
		</div>
		<div class='seccion_form_contacto'>
			<div id='error_container'></div>
			<div id='success_container'></div>
			<div id='loader'><img src="<?php echo $this->webroot . "img/loader.gif"?>"></img></div>
			<input class='enviar' type='button' value='Enviar' />
			<input class='limpiar' type='button' value='Otro' />
		</div>
		<div clasS="clear"></div>
	</form>
    </div><!-- /lightbox-panel -->  
      
    <div  class="lightbox" id="lightbox"> </div><!-- /lightbox -->  
	
<script type="text/javascript">
$(function() {
	//$('li.item img').lightBox();
	$('div.galleryImage a').lightBox(); 
	
});

/****************************************************************************
//** Software License Agreement (BSD License)
//** Book Flip slideshow script- Copyright 2008, Will Jones (coastworx.com)
//** This Script is wholly developed and owned by CoastWorx.com 
//** Copywrite: http://wwww.coastworx.com/
//** You are free to use this script so long as this coptwrite notice 
//** stays intact in its entirety
//** You are NOT Permitted to claim this script as your own or
//** use this script for commercial purposes without the express
//** permission of CoastWorx Technologies!
//** Full credit to Scott Schiller (schillmania.com) for soundManager
//***************************************************************************/
var myPageW=375; //page width
var myPageH=600; //page height
var pageBorderWidth=0; //adjust border width
var pageBorderColor="#000000"; //border color
var pageBorderStyle="solid"; //border style eg. solid, dashed or dotted.

var pSpeed=20; //page speed, 20 is best for Opera browser. Less is faster
var pSound=false; //change to true for flip sound effect, if true, install SoundManager from schillmania.com

var showBinder=false; //change to false for no binder
var binderImage = "parchmentring2.gif"; //location of center binder
var binderWidth = 20; //width of center binder image
var numPixelsToMove = 20;//number of pixels to move per frame, more is faster but less smooth

//You must create the place holder for the dropdown on this page with an id attribute, eg. <select id="flipSelect" style="display:none;"></select>
var selectNavigation=true; //this builds a drop down list of pages for auto navigation.
allowPageClick=true; //allow clicking page directly
doIncrementalAutoFlip = false; //set this to true if you want to flip to selected page incrementally(ie.see each page turn)

ini();
</script>
